<?php
/**
 * (commands)
 */
namespace App\Console\Commands\SpApi\Report\CreateAndGet;

use App\Crontab\Daily\SpApi\GrabGetReport;
use Illuminate\Console\Command;
class GetReport extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'sp-report:get-report {reportType=null} {accountId=0}';

    /**
     * The console command description.
     * @var string
     */
    protected $description = 'exe func';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     */
    public function handle()
    {
        $where = [];
        $reportType = $this->argument('reportType');
        $accountId = $this->argument('accountId');
        if($accountId){
            $where['id'] = $accountId;
        }
        if (file_exists('local.txt')) { //测试账号：账号30-NA
            $where['id'] = 31;
        }

        GrabGetReport::grab($where,$reportType);
        $this->info('finish!');
    }
}
